﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
using VSS_AHT.Forms;
namespace VSS_AHT
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            DevExpress.Utils.AppearanceObject.DefaultFont = new System.Drawing.Font("Tahoma", 10);
            Security.Password1 = "vsa";

            try
            {
                // Bool value to show this application do own Mutex.
                bool ownmutex;

                // Create and get Mutex permission is named icon;
                using (Mutex mutex = new Mutex(true, "VSSAHT", out ownmutex))
                {

                    // If application own Mutex, it can go on execute;
                    // else, application exit.
                    if (ownmutex)
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                       // Application.CurrentCulture = new System.Globalization.CultureInfo("vi-VN");
                        Application.Run(new FormMain());

                        //Dispose Mutex;
                        mutex.ReleaseMutex();
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
    }
}
